using Microsoft.Practices.ServiceLocation;
using MvcMall.Core.Contacts.Services;
using MvcMall.Core.Domains;
using MvcMall.Portal.Controllers.Stores.ViewModels;

namespace MvcMall.Portal.Controllers.Stores.Mappers
{
    public class StoreDomainToInfoMapper
    {
        public StoreInfoDtoModel MapFrom(Store input)
        {
            var model = new StoreInfoDtoModel
                            {
                                IdentityCardId = input.IdentityCardId,
                                IdentityCardImage = input.IdentityCardImage,
                                LicenseImage = input.LicenseImage,
                                OwnerName = input.OwnerName,
                                PromoteUser = input.PromoteUser == null ? string.Empty : input.PromoteUser.UserName,
                                StoreCat = input.StoreCat.Id,
                                StoreDesc = input.StoreDesc,
                                StoreGrade = input.StoreGrade.Id,
                                StoreId = input.Id,
                                StoreIntro = input.StoreIntro,
                                StoreName = input.StoreName,
                                StoreImage = input.StoreImage,
                                StoreType = (int)input.StoreType
                            };
            return model;
        }
    }
}